package com.hyt.it.ogt.kq.service.admission;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hyt.it.ogt.kq.service.gov.feign.ks.model.KwExamVO;
import com.hyt.it.ogt.kq.service.gov.model.dto.admission.PageByCondition;
import com.hyt.it.ogt.kq.service.model.entity.admission.AdmissionTicketInfo;
import com.hyt.it.ogt.kq.service.gov.model.param.admission.AddOrUpdateAdmissionTicketInfoParam;
import com.hyt.it.ogt.kq.service.gov.model.param.admission.ExamineeInfoExportParam;
import com.hyt.it.ogt.kq.service.gov.model.param.admission.UpdateAdmissionTicketInfoParam;
import com.hyt.it.ogt.kq.service.gov.model.vo.admission.AdmissionDataSourceVO;
import com.hyt.it.ogt.kq.service.gov.model.vo.admission.AdmissionKsNameVO;
import com.hyt.it.ogt.kq.service.gov.model.vo.admission.AdmissionTicketInfoVO;
import com.hyt.loginfo.model.Organization;
import com.hyt.loginfo.model.User;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 准考证定义表 服务类
 * </p>
 *
 * @author yanghuankun@talkweb.com.cn
 * @since 2023-01-10
 */
public interface IAdmissionTicketInfoService extends IService<AdmissionTicketInfo> {

    /**
     * 新增准考证任务
     *
     * @param addOrUpdateAdmissionTicketInfoParam
     * @param currentUser
     * @param deptId
     * @return
     */
    String addOrUpdate(AddOrUpdateAdmissionTicketInfoParam addOrUpdateAdmissionTicketInfoParam, User currentUser, String deptId);

    /**
     * 设置归档状态
     *
     * @param updateAdmissionTicketInfoParam
     * @param currentUser
     * @param currentDeptInfo
     */
    void setArchiveStatus(UpdateAdmissionTicketInfoParam updateAdmissionTicketInfoParam, User currentUser, Organization currentDeptInfo);

    /**
     * 根据id删除准考证任务
     *
     * @param id
     * @param currentUser
     * @param deptInfo
     */
    void delete(String id, User currentUser, Organization deptInfo);

    /**
     * 删除考生采集配置
     *
     * @param projectId
     */
    void removeCollect(String projectId);

    /**
     * 根据条件查询准考证任务
     *
     * @param listByConditionDTO
     * @param user
     * @param deptIds
     * @return
     */
    IPage<AdmissionTicketInfoVO> pageByCondition(PageByCondition listByConditionDTO, User user, Set<String> deptIds);

    /**
     * 通过考试id查询
     *
     * @param examId
     * @return
     */
    AdmissionTicketInfo getByExamId(String examId);

    /**
     * 检测准考证任务是否存在，存在则返回，不存在则报错
     *
     * @param examId
     * @return
     */
    AdmissionTicketInfo checkAndGetAdmissionTicketInfo(String examId);

    /**
     * 导出考生名单
     */
    void exportAdmissionTicketExcel(ExamineeInfoExportParam examineeInfoExportParam);

    /***
     * 获取当前机构下面准考证列表
     * @return
     */
    List<AdmissionTicketInfo> queryTicketListByOfficeId(String officeId, String deptId);

    /**
     * 批量下载准考证
     *
     * @return
     */
    void batchDownloadAdmissionTicket(String admissionTicketInfoId, String userId);

    /**
     * 查询数据来源
     *
     * @param admissionTicketInfoId
     * @return
     */
    List<AdmissionDataSourceVO> listDataSource(String admissionTicketInfoId);

    /**
     * 新增和编辑时查询考试名称
     *
     * @param admissionTicketInfoId
     * @param dataSourceCode
     * @param currentUser
     * @param deptIds
     * @return
     */
    List<AdmissionKsNameVO> listExam(String admissionTicketInfoId, Integer dataSourceCode, User currentUser, Set<String> deptIds);

    /**
     * 发布状态（发布 / 取消发布）
     *
     * @param infoId
     * @param status
     * @return
     */
    Boolean setCertificateStatus(String infoId, Boolean status);

    /**
     * 通过id查询准考证vo 查询不到报错
     *
     * @param admissionTicketInfoId
     * @return
     */
    AdmissionTicketInfoVO getVOByAdmissionIdOrThrow(String admissionTicketInfoId);

    /**
     * 通过id查询准考证 查询不到报错
     *
     * @param admissionTicketInfoId
     * @return
     */
    AdmissionTicketInfo getByAdmissionIdOrThrow(String admissionTicketInfoId);

    /**
     * 批量生成准考证
     *
     * @param admissionTicketInfoId 准考证ID
     * @param userId
     * @return
     */
    void batchGenerateAdmissionTicket(String admissionTicketInfoId, String userId);

    /**
     * 更新考试时间
     *
     * @param admissionTaskId
     * @param beginDate
     * @param endDate
     */
    void updateBeginAndEndDate(String admissionTaskId, LocalDateTime beginDate, LocalDateTime endDate);

    /**
     * 通过虚拟考场id或者无考场id查询准考证
     *
     * @param examId
     * @return
     */
    AdmissionTicketInfoVO getVOByExamId(String examId);

    /**
     * 更新考试信息
     *
     * @param examId
     * @param loginUser
     */
    void updateKwExam(String examId, User loginUser);

    /**
     * 更新无考场考试信息
     *
     * @param kwExamVO
     * @param mq
     */
    void updateKwExam(KwExamVO kwExamVO, String mq);
}
